package com.dengyin2000.javaeye.ordering.entity;

import java.io.Serializable;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.Transient;

import org.hibernate.validator.NotNull;
import org.jboss.seam.annotations.Name;

@Entity
@Name("dish")
public class Dish implements Serializable {

	/** 
	 * 
	 */
	private static final long serialVersionUID = 8266978195560663913L;

	private Long id;
	private int no;
	private String name;
	private String description;
	private Integer dishId;
	
	private Long monId;
	private Long tuesId;
	private Long wedId;
	private Long thuId;
	private Long friId;
	private Long satId;
	private Long sunId;
	@Column(name="mon_id")
	public Long getMonId() {
		return monId;
	}
	public void setMonId(Long monId) {
		this.monId = monId;
	}
	@Column(name="tues_id")
	public Long getTuesId() {
		return tuesId;
	}
	public void setTuesId(Long tuesId) {
		this.tuesId = tuesId;
	}
	@Column(name="web_id")
	public Long getWedId() {
		return wedId;
	}
	public void setWedId(Long wedId) {
		this.wedId = wedId;
	}
	@Column(name="thu_id")
	public Long getThuId() {
		return thuId;
	}
	public void setThuId(Long thuId) {
		this.thuId = thuId;
	}
	@Column(name="fri_id")
	public Long getFriId() {
		return friId;
	}
	public void setFriId(Long friId) {
		this.friId = friId;
	}
	@Column(name="sat_id")
	public Long getSatId() {
		return satId;
	}
	public void setSatId(Long satId) {
		this.satId = satId;
	}
	@Column(name="sun_id")
	public Long getSunId() {
		return sunId;
	}
	public void setSunId(Long sunId) {
		this.sunId = sunId;
	}
	@Id @GeneratedValue(strategy=GenerationType.IDENTITY)
	public Long getId() {
		return id;
	}
	public void setId(Long id) {
		this.id = id;
	}
	@NotNull
	public String getName() {
		return name;
	}
	public void setName(String name) {
		this.name = name;
	}
	public String getDescription() {
		return description;
	}
	public void setDescription(String description) {
		this.description = description;
	}
	@Column(name="dish_id")
	public Integer getDishId() {
		return dishId;
	}
	public void setDishId(Integer dishId) {
		this.dishId = dishId;
	}
	@NotNull
	public int getNo() {
		return no;
	}
	public void setNo(int no) {
		this.no = no;
	}
	
	@Transient
	public Long getSnackShopId() {
		if (getMonId() != null)
			return getMonId();
		if (getTuesId() != null) 
			return getTuesId();
		if (getWedId() != null)
			return getWedId();
		if (getThuId() != null)
			return getThuId();
		if (getFriId() != null)
			return getThuId();
		if (getSatId() != null)
			return getSatId();
		if (getSunId() != null)
			return getSunId();
		return null;
	}
}
